package com.candy.bean;

/**
 * @author donglin
 * @Title:
 * @类名: Student
 * @date 2020/5/20
 */
public class Student {
    //定义属性,普通的成员变量
    private String stuName;
    private  int stuAge;
    private boolean stuSex;
    //静态变量，加上static进行修饰，表示全类所有
    public static String schoolName;
    //常量的声明方式，static+final，常量一经声明，必须赋初始值
    public static final String obName="java基础";



    //无参构造
    public Student() {
    }
    //全参构造
    public Student(String stuName, int stuAge, boolean stuSex) {
        this.stuName = stuName;
        this.stuAge = stuAge;
        this.stuSex = stuSex;
    }
    //get方法，获取属性的值
    public String getStuName() {
        return stuName;
    }
    //set方法，对属性进行赋值
    public void setStuName(String stuName) {
        this.stuName = stuName;
    }

    public int getStuAge() {
        return stuAge;
    }

    public void setStuAge(int stuAge) {
        this.stuAge = stuAge;
    }

    public boolean isStuSex() {
        return stuSex;
    }

    public void setStuSex(boolean stuSex) {
        this.stuSex = stuSex;
    }
    //静态的方法，加上static进行修饰，使用的时候是类名直接点着就可以，静态方法只能访问静态的变量
    public  static  void  sayHi(){
        System.out.println("大家好呀，我所在的学校是："+schoolName);
    }
    //非静态方法，可以访问静态的变量以及非静态的变量
    public  void sayHello(){
        System.out.println("大家好呀，我是"+stuName+"所在的学校是："+schoolName);
    }
}
